package com.zsq.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.SimpleFormatter;

/**
 * @author zsq
 * 时间 2020/2/4 16:03
 **/
public class DateUtil {

    public static final String PATTERN_STANDARD08W = "yyyyMMdd";
    public static final String PATTERN_STANDARD12W = "yyyyMMddHHmm";
    public static final String PATTERN_STANDARD14W = "yyyyMMddHHmmss";
    public static final String PATTERN_STANDARD17W = "yyyyMMddHHmmssSSS";

    public static final String PATTERN_STANDARD10H = "yyyy-MM-dd";
    public static final String PATTERN_STANDARD16H = "yyyy-MM-dd HH:mm";
    public static final String PATTERN_STANDARD19H = "yyyy-MM-dd HH:mm:ss";

    public static final String PATTERN_STANDARD10X = "yyyy/MM/dd";
    public static final String PATTERN_STANDARD16X = "yyyy/MM/dd HH:mm";
    public static final String PATTERN_STANDARD19X = "yyyy/MM/dd HH:mm:ss";

    /**
     * 获取当前日期标准字符串
     * @return
     */
    public static String getCurrentDateString(){
        SimpleDateFormat sf = new SimpleDateFormat(PATTERN_STANDARD19H);
        Date date = new Date();
        return sf.format(date);
    }

    /**
     * 获取当前日期字符串
     * @param formatString 格式字符串
     * @return
     */
    public static String getCurrentDateString(String formatString){
        SimpleDateFormat sf = new SimpleDateFormat(formatString);
        Date date = new Date();
        return sf.format(date);
    }
}
